]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Destroy old layout actors when regenerating keyboard groups
authorCarlos Garnacho <carlosg@gnome.org>
Tue, 30 Apr 2019 12:08:25 +0000 (14:08 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 30 Apr 2019 19:33:02 +0000 (21:33 +0200)
We were cleaning up self._groups, but the actors for all previous
groups/layers/modes would remain attached to the aspect container,
simply hidden.

Under some circumstances this can really make the amount of actors
in the shell stage to quickly ramp up, it's not just a "leak" but
also has potential side effects on performance.

We should destroy all child actors of this._aspectContainer, except
the static ones (emoji and keypad).

While at it, fix this._groups re-initialization, as it's actually an
object, not an array.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/523
Closes?: https://gitlab.gnome.org/GNOME/mutter/issues/556

js/ui/keyboard.js

index 71ebd5596fceb4f936ba7924d608251674076df0..fbba2840e5890f7e48a48cd29501650a012a8cd1 100644 (file)
@@ -1472,7 +1472,12 @@ var Keyboard = class Keyboard {
     }
 
     _onKeyboardGroupsChanged(keyboard) {
-        this._groups = [];
+        let nonGroupActors = [this._emojiSelection.actor, this._keypad.actor];
+        this._aspectContainer.get_children().filter(c => !nonGroupActors.includes(c)).forEach(c => {
+            c.destroy();
+        });
+
+        this._groups = {};
         this._onGroupChanged();
     }